﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ICM_Dispense.aspx.cs" Inherits="KPIS.GERP.GIMS.APP.APP_UI.Edit_Form.ICM_Dispense" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <title>แสดงรายการจำหน่ายพัสดุ</title>
    <link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css"/>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" >
    </asp:ScriptManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
       <script type="text/javascript" src="../../Scripts/Common.js"></script>
              <script type="text/javascript">
              //========================= SendRepairDate Date ============================// 
                Sys.Application.add_load(setCalendarDispenseDateTable);                
                function setCalendarDispenseDateTable() {
                    var tooltip = $find("<%= ToolTipDispenseDate.ClientID %>");
                    var calendar = $find("<%= CalendarDispenseDate.ClientID %>");                       
                    var fastNavigation = calendar._getFastNavigation();
                    fastNavigation.OnToday =
                    function()
                    {
                        var today = new Date;
                        var date = [today.getFullYear(), today.getMonth()+ 1, today.getDate()];
                        calendar.selectDate(date, true);
                        fastNavigation.Popup.Hide();  
                        var all_date = date.toString().split(",");
                        var year = parseInt(all_date[0]) + 543;
                        var month = all_date[1];
                        var day = all_date[2];
                        if (day.length == 1) {
                            day = '0' + day;
                        }
                        if (month.length == 1) {
                            month = '0' + month;
                        }

                        var maskText = $find("<%= txtDispenseDate.ClientID %>");
                        maskText.set_value(day + month + year);
                        tooltip.hide();
                    }
                }
                function OnSendDispenseDateClick(calendarInstance, args) {
                    var tooltip = $find("<%= ToolTipDispenseDate.ClientID %>");
                    var fastNavigation = calendarInstance._getFastNavigation();
                    var date = args.get_renderDay().get_date().toString();
                    var all_date = date.split(",");
                    var year = parseInt(all_date[0]) + 543;
                    var month = all_date[1];
                    var day = all_date[2];
                    if (day.length == 1) {
                        day = '0' + day;
                    }
                    if (month.length == 1) {
                        month = '0' + month;
                    }

                    var maskText = $find("<%= txtDispenseDate.ClientID %>");
                    maskText.set_value(day + month + year);
                    tooltip.hide();
                }
                function OnCalendarDispenseDateChanged(sender, step) {
                    var year = parseInt(sender.FocusedDate[0]) + 543;
                    var month = sender.FocusedDate[1];
                    document.getElementById("CalendarDispenseDate_Title").innerHTML = changeMonthNumberToName(month) + " " + year; 
                }
                //===========================================================
                function onTextChangeGeneral(sender) {
                    if (sender.get_value() == "") {
                        sender.set_text("");
                    }
                }
                // Cancel_Click
                function GetRadWindow() 
                           {
                                var oWindow = null;
                                if (window.radWindow)
                                    oWindow = window.RadWindow; 
                                else if (window.frameElement.radWindow)
                                    oWindow = window.frameElement.radWindow; 
                                return oWindow;
                            }
                           function CloseWindow() 
                           {
                                 GetRadWindow().Close();
                           }
              </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
                   <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="grdInventory">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="grdInventory" LoadingPanelID="RadAjaxLoadingPanel1" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                   </AjaxSettings>            
    </telerik:RadAjaxManager>
          <asp:Panel ID="Panel6" runat="server" ScrollBars="None" Visible="true">
                <div class="bigModulePaneFull">
                    <div class="bigModuleBottomPaneFull">
                         <table cellpadding="0" cellspacing="0">
                            <tr class="command-list">
                                <td >
                                    <asp:LinkButton ID="btnEdit" runat="server" CssClass="LinkButton"  visible="false" OnClick="btnEdit_Click">
                                        <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Edit.gif" />&nbsp;&nbsp;แก้ไขข้อมูล
                                    </asp:LinkButton>
                                </td>
                                <td class="command-item">
                                    <asp:LinkButton ID="btnSave" runat="server" CssClass="LinkButton" Visible="true" onclick="btnSave_Click">
                                        <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cmd_Save.gif" />&nbsp;&nbsp;บันทึกข้อมูล
                                    </asp:LinkButton>
                                </td>
                                <td class="command-item">
                                    <asp:LinkButton ID="btnCancel" runat="server" CssClass="LinkButton" Visible="true" onclick="btnCancel_Click" CausesValidation="false">
                                        <img style="border:0px;vertical-align:middle;" alt="" src="../Image/Grid/Cancel.gif" />&nbsp;&nbsp;ยกเลิก
                                    </asp:LinkButton>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </asp:Panel>              
           <div class="bigModulePaneFull">
                <div class="bigModuleBottomPaneFull">                        
                     <div class="header-grid" align="left">
                          <asp:Label ID="lblHeaderList" runat="server" Text="รายการจำหน่ายพัสดุ" ></asp:Label>
                     </div>
                         <asp:Panel ID="Panel1" runat="server" CssClass="contentPaneDiv" Height="350px" ScrollBars="Auto">
                         <div class="formList-detail">
                             <table>
                                 <tr>
                                        <td valign="top" width="150px">
                                            <asp:Label CssClass="font-label" runat = "server" ID= "lblDispenseDate" Text = "วันที่จำหน่ายพัสดุ : " Font-Bold="false"/>
                                        </td>
                                        <td>
                                            <telerik:RadMaskedTextBox ID="txtDispenseDate" runat="server" Mask=" ##/##/####" SelectionOnFocus="SelectAll" TextWithLiterals=" //" Width="75px">
                                            </telerik:RadMaskedTextBox>
                                        </td>
                                        <td width="220px" >
                                              <asp:LinkButton ID="lbtDispenseDate" runat="server" CssClass="LinkButton">
                                                    <img alt="" src="../Image/Icon/Calendar.gif" style="border:0px;vertical-align:middle;" />
                                              </asp:LinkButton>
                                              <telerik:RadToolTip ID="ToolTipDispenseDate" runat="server" Animation="None" HideEvent="LeaveToolTip" Position="MiddleRight" ShowEvent="OnClick" Skin="Telerik" 
                                                TargetControlID="lbtDispenseDate" Modal="true">
                                                    <telerik:RadCalendar 
                                                        id="CalendarDispenseDate" 
                                                        runat="server" 
                                                        TitleFormat="MMMM yyyy" 
                                                        EnableMultiSelect="false" 
                                                        UseRowHeadersAsSelectors="false" 
                                                        UseColumnHeadersAsSelectors="false" 
                                                        DayCellToolTipFormat="dddd, dd MMMM, yyyy" 
                                                        NavigationPrevToolTip="เดือนก่อนหน้า" 
                                                        NavigationNextToolTip="เดือนถัดไป" 
                                                        FastNavigationNextToolTip="3 เดือนถัดไป" 
                                                        FastNavigationPrevToolTip="3 เดือนก่อนหน้า">
                                                        <ClientEvents 
                                                            OnDateClick="OnSendDispenseDateClick" 
                                                            OnCalendarViewChanged="OnCalendarDispenseDateChanged">
                                                        </ClientEvents>
                                                        <FastNavigationSettings 
                                                            EnableTodayButtonSelection="true" 
                                                            TodayButtonCaption="ไปที่วันนี้" 
                                                            OkButtonCaption="เปลี่ยน" 
                                                            CancelButtonCaption="ยกเลิก" />
                                                    </telerik:RadCalendar>
                                              </telerik:RadToolTip>
                                                &nbsp;<label id="Label3" runat="server"><font color="red">*</font></label>
                                        </td>
                                 </tr>
                             </table>
                         </div>
                         <div class="formList-detail">
                             <table>
                                 <tr>
                                    <td valign="top" width="150px">
                                        <asp:Label CssClass="font-label" runat = "server" ID= "Label6" 
                                        Text = "เรื่อง : " Font-Bold="false"/>
                                    </td>
                                    <td>
                                       <telerik:RadTextBox  ID="txtDispenceName" runat="server" Width="450" Height="15px" />                                                           
                                    <asp:RequiredFieldValidator runat="server" 
                                        ID="RequiredFieldValidator4" 
                                        ControlToValidate="txtDispenceName"
                                        ErrorMessage="กรุณากรอกข้อมูลเรื่อง" >
                                    </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                             </table>
                         </div>
                         <div class="formList-detail">
                             <table>
                                 <tr>
                                    <td valign="top" width="150px">
                                        <asp:Label CssClass="font-label" runat = "server" ID= "Label1" 
                                        Text = "รหัสพัสดุ : " Font-Bold="false"/>
                                    </td>
                                    <td> 
                                        <telerik:RadComboBox ID="cmbAssetCode" runat="server" 
                                            AllowCustomText="true" EmptyMessage="< พิมพ์ที่นี้เพื่อค้นหา >" 
                                            EnableLoadOnDemand="true" EnableVirtualScrolling="true" Height="230px" 
                                            HighlightTemplatedItems="true" MarkFirstMatch="false" 
                                            OnClientTextChange="onTextChangeGeneral" 
                                            OnItemsRequested="cmbAssetCode_ItemsRequested"                                                                         
                                            ShowDropDownOnTextboxClick="true" 
                                            ShowMoreResultsBox="true" 
                                            Width="450px">
                                            <HeaderTemplate>
                                                <table cellpadding="0" cellspacing="0" class="font-label">
                                                    <tr>
                                                        <td align="left" width="100px"><b>เลขที่พัสดุ</b></td>
                                                        <td align="left" width="250px"><b>รายการพัสดุ</b></td>                                     
                                                    </tr>
                                                </table>
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:Table ID="tableAssetCode" runat="server" CellPadding="0" 
                                                    CellSpacing="0" CssClass="font-label">
                                                </asp:Table>
                                            </ItemTemplate>
                                        </telerik:RadComboBox>                                                           
                                        <asp:RequiredFieldValidator runat="server" 
                                            ID="RequiredFieldValidator1" 
                                            ControlToValidate="cmbAssetCode"
                                            ErrorMessage="กรุณากรอกข้อมูลรหัสพัสดุ" >
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                             </table>
                         </div>
                         <div class="formList-detail">
                             <table>
                                 <tr>
                                    <td valign="top" width="150px">
                                        <asp:Label CssClass="font-label" runat = "server" ID= "Label2" 
                                        Text = "ประเภทการจำหน่าย : " Font-Bold="false"/>
                                    </td>
                                    <td>
                                        <telerik:RadComboBox 
                                            runat="server" 
                                            ID="cmbDispenseType" 
                                            AllowCustomText ="true" 
                                            DataTextField="Name" 
                                            DataValueField="Sequence" 
                                            Filter ="Contains"
                                            CausesValidation ="false"
                                            OnClientTextChange="onTextChangeGeneral" 
                                            AutoPostBack="true"                                          
                                            EmptyMessage = "< การจำหน่าย >"
                                            Width="300px" >
                                        </telerik:RadComboBox>                                                            
                                        <asp:RequiredFieldValidator runat="server" 
                                            ID="RequiredFieldValidator2" 
                                            ControlToValidate="cmbDispenseType"
                                            ErrorMessage="กรุณากรอกข้อมูลประเภทการจำหน่าย" >
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                             </table>
                         </div>
                         <div class="formList-detail">
                            <fieldset id="fsReceiveTo" runat ="server">
                                <%--<legend><asp:Label ID ="lblReceiveTo" runat="server" Text ="สถานที่รับเข้า" CssClass="font-label" Font-Bold="true" /></legend>--%>                                   
                                   <table>
                                         <tr>
                                            <td valign="top" width="150px">
                                                <asp:Label CssClass="font-label" runat = "server" ID= "lblLocationReceive" Text = "สถานที่ต้นทาง   : " Font-Bold="false"/>
                                            </td>
                                            <td>
                                                    
                                                <asp:RadioButton 
                                                    CssClass="font-label" ID="rbWarehouse" AutoPostBack="True" runat="server" Text="คลังพัสดุ" Checked="true"
                                                    GroupName="gbLocationReceive" Width ="200px" OnCheckedChanged="rbWarehouse_CheckedChanged" >
                                                </asp:RadioButton>
                                                <asp:RadioButton 
                                                    CssClass="font-label" ID="rbJobsite" AutoPostBack="True" runat="server" Text="สำนัก/กอง/ศูนย์"
                                                    GroupName="gbLocationReceive" Width="200px" OnCheckedChanged ="rbJobsite_CheckedChanged" >
                                                </asp:RadioButton>
                                                <asp:RadioButton 
                                                    CssClass="font-label" ID="rbOther" AutoPostBack="True" runat="server" Text="อื่น ๆ"
                                                    GroupName="gbLocationReceive" Width="200px" OnCheckedChanged ="rbOther_CheckedChanged" >
                                                </asp:RadioButton>   
                                            </td>
                                         </tr>
                                         <tr>
                                            <td></td>
                                            <td>                                                  
                                                <telerik:RadComboBox ID="cmbWarehouse" Runat="server"
                                                    DataTextField="name" DataValueField="seq" 
                                                    EnableLoadOnDemand="true" Visible="true"
                                                    ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                                    EmptyMessage="< เลือกคลังข้อมูล >" AllowCustomText="true" Filter="Contains"
                                                    OnClientTextChange="onTextChangeGeneral"
                                                    OnItemsRequested="cmbWarehouse_ItemsRequested" Width="450px" title="เลือกคลังข้อมูล">
                                                 </telerik:RadComboBox>
                                                <telerik:RadComboBox ID="cmbJobSite" Runat="server"
                                                    DataTextField="job_site_name" DataValueField="job_site_seq" 
                                                    EnableLoadOnDemand="true" Visible="false"
                                                    ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                                    EmptyMessage="< เลือกหน่วยงาน >" AllowCustomText="true" Filter="Contains"
                                                    OnClientTextChange="onTextChangeGeneral"
                                                    OnItemsRequested="cmbJobSite_ItemsRequested" Width="450px" title="เลือกหน่วยงาน">
                                                 </telerik:RadComboBox>
                                                 <telerik:RadTextBox 
                                                    ID="txtOther" 
                                                    runat="server" 
                                                    title="ระบุ" 
                                                    Width="450"   
                                                    Height="15px" 
                                                    Visible="false">
                                                 </telerik:RadTextBox>  
                                            </td>
                                         </tr>
                                   </table>
                                 </fieldset> 
                            </div>
                        <div class="formList-detail">
                             <table>
                                 <tr>
                                    <td valign="top" width="150px">
                                        <asp:Label CssClass="font-label" runat = "server" ID= "Label4" 
                                        Text = "สถานที่จำหน่าย : " Font-Bold="false"/>
                                    </td>
                                    <td>
                                       <telerik:RadTextBox  ID="txtDestination" runat="server" title="อื่นๆ" Width="450" Height="15px" />                                                           
                                    <asp:RequiredFieldValidator runat="server" 
                                        ID="RequiredFieldValidator3" 
                                        ControlToValidate="txtDestination"
                                        ErrorMessage="กรุณากรอกข้อมูลสถานที่จำหน่าย" >
                                    </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                             </table>
                         </div>
                         <div class="formList-detail">
                             <table>
                                 <tr>
                                    <td valign="top" width="150px">
                                        <asp:Label CssClass="font-label" runat = "server" ID= "Label5" 
                                        Text = " รายละเอียดเพิมเติม: " Font-Bold="false"/>
                                    </td>
                                    <td>
                                        <telerik:RadTextBox  ID="txtRemark" runat="server" Width="450" Height="60px" />
                                    </td>
                                </tr>
                             </table>
                        </div>
                  </asp:Panel>                           
              </div>
        </div>     
    </form>
</body>
</html>
